<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('attraction_spot', function (Blueprint $table) {
            $table->comment('点位表');
            $table->bigIncrements('id');
            $table->string('name', 64)->nullable(false)->comment('点位名称');
            $table->integer('position_id')->nullable(true)->comment('位置Id');
            $table->integer('type_id')->nullable(false)->comment('点位类型Id');
            $table->string('intro_title', 128)->default('')->comment('点位介绍标题');
            $table->longText('intro')->nullable(true)->comment('点位介绍');
            $table->integer('attraction_id')->nullable(false)->comment('所属景区Id');
            $table->string('cover_id', 64)->nullable(true)->comment('点位封面,关联attachment表');
            $table->integer('show_type')->nullable(false)->comment('显示类型1:管理端显示2:管理游客双端显示');
            $table->string('icon_id')->nullable(true)->comment('点位图标Id,关联attachment表');
            $table->integer('status')->nullable(false)->default(0)->comment('点位状态1:禁用2:正常');
            $table->integer('sort')->nullable(false)->default(100)->comment('点位排序');
            $table->json('extension')->nullable(true)->comment('点位扩展字段');
            $table->datetimes();
            $table->index(['name']);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('attraction_spot');
    }
};
